
#ifndef __SEGMENT_H
#define __SEGMENT_H

#include "dictionary/dict.h"
#include "pat_array.h"
#include "sentence.h"
#include "suffix_tree.h"

class Segmentor
{
protected:
	wchar_t * document;
	Sentence *head;
	Sentence *tail;

public:

	Segmentor();
	virtual ~Segmentor();
	
	void analysisDocument(wchar_t * wdocument);
	bool analysisFile(const char * wdocument);

	virtual void info()=0;
	
protected:

	virtual void generateNewWord() = 0;
	virtual void segmentSentence(Sentence * se)=0;
	virtual void splitIntoSentences()=0;

	void segmentSentences();
	void addSentence(wchar_t *senten, bool needSplit,int size);
	bool isChinese(wchar_t * t);
	bool isAlphabet(wchar_t *t);
};


class ChineseSegmentor: public Segmentor
{
private:
	Dictionary *dict;
	PatArray<wchar_t> *patArray;
	PatArray<SegmentFragment> *segPatArray; 

public:

	ChineseSegmentor();
	virtual ~ChineseSegmentor();
	virtual void info();


protected:

	virtual void generateNewWord(); 
	virtual void segmentSentence(Sentence * se);
	virtual void splitIntoSentences();
};


////-----------English Segmentor class definition-----------
//
//class EnglishSegmentor: public Segmentor
//{
//private:
//	PatArray<wchar_t> *patArray;
//public:
//
//	EnglishSegmentor();
//	virtual ~EnglishSegmentor();
//	virtual void info();
//
//protected:
//
//	virtual void generateNewWord(); 
//	virtual void segmentSentence(Sentence * se);
//	virtual void splitIntoSentences();
//};
#endif